<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
	window.onload=function(){
		var oBtn = document.getElementById('btn1');
		
		oBtn.onclick = function()
		{
			//create ajax object
			if(window.XMLHttpRequest){
				var oAjax = new XMLHttpRequest();	
			}else
			{
				var oAjax = ActiveXObject("Microsoft.XMLHTTP");
			}
			
			//oAjax.readyState = 0 
			//connect to server
			oAjax.open('GET', 'a.txt?t=' + new Date().getTime(), true);
			
			//send request
			oAjax.send(); 		

			
			//receive res
			oAjax.onreadystatechange=function()
			{
				if(oAjax.readyState==4){
					if(oAjax.status==200|| oAjax.status==304){
						alert('success ' + oAjax.responseText);
					}else{
						alert('fail ' + oAjax.status);
					}
				}
					
			};
			
		};
		
	};
	
</script>
</head>

<body>
<input type="button" id="btn1" value="read">
</body>
</html>
